import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'home',
        component: () => import('../components/Layout'),
        children:[
            {
                path: '',
                name: 'home',
                component: () => import('../views/Home')
            },
            {
                path: 'home',
                name: 'home',
                component: () => import('../views/Home')
            },
            {
                path: '/device',
                name: 'device',
                component: () => import('../views/Device')
            },
            {
                path: '/devicetype',
                name: 'devicetype',
                component: () => import('../views/DeviceType')
            },
            {
                path: '/dictionary',
                name: 'dictionary',
                component: () => import('../views/system/Dictionary')
            },
            {
                path: '/menu',
                name: 'menu',
                component: () => import('../views/system/Menu')
            },
            {
                path: '/user',
                name: 'user',
                component: () => import('../views/grant/User')
            },
            {
                path: '/role',
                name: 'role',
                component: () => import('../views/grant/Role')
            },
            {
                path: '/grant',
                name: 'grant',
                component: () => import('../views/grant/Grant')
            }
        ]
    },
    {
        path:'/login',
        name:'login',
        meta:{
            title:'登录',
        },
        component: () => import('../views/Login')
    }
]

const router = new VueRouter({
    mode: 'hash',
    base: process.env.BASE_URL,
    routes
})

export default router
